package com.sl.au.service;

import java.util.List;
import java.util.Map;

import org.activiti.engine.runtime.ProcessInstance;

import com.sl.au.entity.ProductPlanForCRM;
import com.sl.au.entity.Quote;
import com.sl.au.entity.QuoteDevice;
import com.sl.au.entity.QuoteReplacement;
import com.sl.au.entity.User;
import com.sl.au.repository.QuoteReplacementRepository;
import com.sl.au.repository.QuoteRepository;

/**
 * 普通价格单Service
 */
public interface QuoteService extends BaseService {

	QuoteRepository getRepository();
	
	QuoteReplacementRepository getRepository1();
	
	
	/***
	 * 重新梳理序号
	 * @param quoteId
	 */
	void reCheckQuoteIndex(String quoteId);
	
	/***
	 * 获取当前对象的序号及总数
	 * @param quoteReplacement
	 * @return
	 */
	long[] getNowIndexAndCount(QuoteReplacement quoteReplacement);
	
	/***
	 * 获取当前选择行上一条或者下一条数据
	 * @param id 当前行ID
	 * @param nowIndex 当前行顺序号
	 * @param isNext 0 before 1 next
	 * @return
	 */
	QuoteReplacement getNextOrBeforeOtherDevice(String nowQuoteId,int nowIndex,int isNext);
	
	/***
	 * 保存备件数据
	 * @param quoteReplacement
	 * @param quoteReplacements
	 * @param isInit
	 */
	
	void saveOtherDevice(QuoteReplacement quoteReplacement,List<QuoteReplacement> quoteReplacements,boolean isInit);
	
	/**得到普通价格单页面数据List
	 * @param key  查询条件
	 */
	List<Quote> getQuote(int start, int length, Map<String,String> condition, String orderName, String dir);
	/**
	 * 得到普通价格单数据条数
	 * @param condition
	 */
	long getQuoteCount(Map<String, String> condition);
  /**
   * 根据普通价格单id和设备细目类型得到quoteDevice
   * @param quoteId 普通价格单的Id
   * @return
   */
	List<QuoteDevice> getQuoteDevice(int start, int length, String quoteId, String orderName,
			String dir);
	
	/**根据普通价格单Id得到其他设备细目
	 * @param quoteId  普通价格单Id
	 * @return page
	 */
	List<QuoteReplacement> getQuoteReplacement(int start, int length, String quoteId, String orderName, String dir);
	
	List<QuoteReplacement> getHisDetails(int start, int length, Map<String, String> condition, String orderName, String dir);
	
	long getHisDetailsCount( Map<String, String> condition);

    void saveProcessStart(String quoteId, ProcessInstance pInst);
    
    /**
	 *获得一个部门
	 *某一种审批状态的报价单 
	 * @param key  查询条件
	 */
	List<Quote> getQuoteInState(int start, int length, String key, String audit,String superior);

   
	/**生成普通报价单
	 * @param quoteId
	 * @return 返回生成WORD文件全路径
	 * @Author:Neil
	 */
	public String genQuoteDocx(String quoteId,String sender);
	
	
	/**生成备件报价单
	 * @param quoteId
	 * @return 返回生成WORD文件全路径
	 * @Author:Neil
	 */
	public String genQuoteBJDocx (String quoteId,User user) ;
	/*
	 * 查询泵的历史报价
	 */
	List<QuoteDevice> searchQuoteDevicePrice(int start, int length, Map<String,String> condition);
	
	long searchQuoteDeviceCount( Map<String,String> condition);
	
	/*
	 * 查询备件的历史报价
	 */
	List<QuoteReplacement> searchQuoteReplacePrice(int start, int length, Map<String,String> condition);
	
	long searchQuoteReplaceCount( Map<String,String> condition);

	List<QuoteReplacement> getQuoteReplacementER(int start, int length, Map<String, String> condition, String orderName,
			String dir);

	List<QuoteReplacement> getQuoteReplacementERprice(int start, int length, Map<String, String> condition,
			String orderName, String dir);
	
	List<Quote> getpagehisquote(int start, int length, Map<String, String> condition, String orderName, String dir);
	
	long getpagehisquoteCount( Map<String, String> condition);

	String genQuoteBJHTDocx(String quoteId, User user) throws Exception;
	
}
